//
//  IDPViewController.m
//  UIPickerView
//
//  Created by iD Student on 7/11/13.
//  Copyright (c) 2013 iD Student. All rights reserved.
//

#import "IDPViewController.h"
#import "MainMenuViewController.h"
@interface IDPViewController ()

@end

@implementation IDPViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    colorList = [[NSMutableArray alloc] init];
    [colorList addObject:@"LOL"];
    [colorList addObject:@"Blue"];
    [colorList addObject:@"Green"];
    
    colorPicker.delegate = self;
    colorPicker.dataSource = self;
}

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView
{
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)thePickerView
numberOfRowsInComponent:(NSInteger)component
{
    return colorList.count;
}

- (NSString *)pickerView:(UIPickerView *)thePickerVIew titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return [colorList objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;
{
    selectedRow = row;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)changePressed:(id)sender
{
    NSString *selectedColor = [colorList objectAtIndex:selectedRow];
    if([selectedColor compare: @"LOL"] == NSOrderedSame)
    {
        backImage.image = [UIImage imageNamed:@"i try.png"];
        backgroundImage = backImage.image;
        /*[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"i try.png"]]];*/
    }
    if([selectedColor compare: @"Blue"] == NSOrderedSame)
    {
        [self.view setBackgroundColor:[UIColor blueColor]];
    }
    if([selectedColor compare: @"Green"] == NSOrderedSame)
    {
        [self.view setBackgroundColor:[UIColor greenColor]];
    }
    
}


@end
